home *** CD-ROM | disk | FTP | other *** search
/ Aminet 19 / Aminet 19 (1997)(GTI - Schatztruhe)[!][Jun 1997].iso / Aminet / dev / mui / MUIPlusPlus.lha / Source / NList / HeaderEnd next >
Encoding:
Text File  |  1997-03-16  |  10.7 KB  |  565 lines

  1. #ifdef MUIPP_TEMPLATES
  2.  
  3. /***************************************************************************
  4. **                       CMUI_NList class definition
  5. ***************************************************************************/
  6.  
  7. template <class Type>
  8. class CTMUI_NList : public CMUI_Area
  9. {
  10. public:
  11.     CTMUI_NList (void)
  12.     : CMUI_Area ()
  13.     {
  14.     }
  15.  
  16.     CTMUI_NList (Tag tag1, ...)
  17.     : CMUI_Area ()
  18.     {
  19.         object = MUI_NewObjectA (MUIC_NList, (struct TagItem *)&tag1);
  20. #ifdef MUIPP_DEBUG
  21.         if (object == NULL)
  22.             _MUIPPWarning ("Could not create a CTMUI_NList object\n");
  23. #endif
  24.     }
  25.  
  26.     CTMUI_NList (Object * obj)
  27.     : CMUI_Area ()
  28.     {
  29.         object = obj;
  30.     }
  31.  
  32.     CTMUI_NList & operator = (Object * obj)
  33.     {
  34.         object = obj;
  35.         return *this;
  36.     }
  37.  
  38.     // By overloading the [] operator you can treat lists like arrays
  39.  
  40.     Type & operator [] (LONG pos)
  41.     {
  42.         Type * entry;
  43.         DoMethod (MUIM_NList_GetEntry, pos, &entry);
  44. #ifdef MUIPP_DEBUG
  45.         if (entry == NULL)
  46.             _MUIPPError ("Index into CTMUI_NList is out of range:\n"
  47.                          "Index = %d, length = %d\n",
  48.                          (int)pos,
  49.                          (int)GetAttr(MUIA_NList_Entries));
  50. #endif
  51.         return *entry;
  52.     }
  53.  
  54.     // This method is a convienient alternative to the Entries attribute
  55.  
  56.     LONG Length (void) const
  57.     {
  58.         return (LONG)GetAttr (MUIA_NList_Entries);
  59.     }
  60.  
  61.     // This method can be used to retrieve the number of selected entries
  62.     // in a list
  63.  
  64.     ULONG NumSelected (void)
  65.     {
  66.         ULONG numSelected;
  67.         DoMethod (MUIM_NList_Select, MUIV_NList_Select_All, MUIV_NList_Select_Ask, &numSelected);
  68.         return numSelected;
  69.     }
  70.  
  71.     // These methods can be used as shortcuts for inserting objects into lists
  72.  
  73.     void AddHead (Type * entry)
  74.     {
  75.         DoMethod (MUIM_NList_InsertSingle, entry, MUIV_NList_Insert_Top);
  76.     }
  77.  
  78.     void AddHead (Type & entry)
  79.     {
  80.         DoMethod (MUIM_NList_InsertSingle, &entry, MUIV_NList_Insert_Top);
  81.     }
  82.  
  83.     void AddTail (Type * entry)
  84.     {
  85.         DoMethod (MUIM_NList_InsertSingle, entry, MUIV_NList_Insert_Bottom);
  86.     }
  87.  
  88.     void AddTail (Type & entry)
  89.     {
  90.         DoMethod (MUIM_NList_InsertSingle, &entry, MUIV_NList_Insert_Bottom);
  91.     }
  92.  
  93.     void InsertTop (Type * entry)
  94.     {
  95.         DoMethod (MUIM_NList_InsertSingle, entry, MUIV_NList_Insert_Top);
  96.     }
  97.  
  98.     void InsertTop (Type & entry)
  99.     {
  100.         DoMethod (MUIM_NList_InsertSingle, &entry, MUIV_NList_Insert_Top);
  101.     }
  102.  
  103.     void InsertBottom (Type * entry)
  104.     {
  105.         DoMethod (MUIM_NList_InsertSingle, entry, MUIV_NList_Insert_Bottom);
  106.     }
  107.  
  108.     void InsertBottom (Type & entry)
  109.     {
  110.         DoMethod (MUIM_NList_InsertSingle, &entry, MUIV_NList_Insert_Bottom);
  111.     }
  112.  
  113.     void InsertSorted (Type * entry)
  114.     {
  115.         DoMethod (MUIM_NList_InsertSingle, entry, MUIV_NList_Insert_Sorted);
  116.     }
  117.  
  118.     void InsertSorted (Type & entry)
  119.     {
  120.         DoMethod (MUIM_NList_InsertSingle, &entry, MUIV_NList_Insert_Sorted);
  121.     }
  122.  
  123.     void InsertActive (Type * entry)
  124.     {
  125.         DoMethod (MUIM_NList_InsertSingle, entry, MUIV_NList_Insert_Active);
  126.     }
  127.  
  128.     void InsertActive (Type & entry)
  129.     {
  130.         DoMethod (MUIM_NList_InsertSingle, &entry, MUIV_NList_Insert_Active);
  131.     }
  132.  
  133.     LONG Active (void) const
  134.     {
  135.          return (LONG)GetAttr (MUIA_NList_Active);
  136.     }
  137.  
  138.     void SetActive (LONG value)
  139.     {
  140.          SetAttr (MUIA_NList_Active, (ULONG)value);
  141.     }
  142.  
  143.     void SetAutoCopyToClip (BOOL value)
  144.     {
  145.          SetAttr (MUIA_NList_AutoCopyToClip, (ULONG)value);
  146.     }
  147.  
  148.     BOOL AutoVisible (void) const
  149.     {
  150.          return (BOOL)GetAttr (MUIA_NList_AutoVisible);
  151.     }
  152.  
  153.     void SetAutoVisible (BOOL value)
  154.     {
  155.          SetAttr (MUIA_NList_AutoVisible, (ULONG)value);
  156.     }
  157.  
  158.     LONG ClickColumn (void) const
  159.     {
  160.          return (LONG)GetAttr (MUIA_NList_ClickColumn);
  161.     }
  162.  
  163.     void SetCompareHook (struct Hook * value)
  164.     {
  165.          SetAttr (MUIA_NList_CompareHook, (ULONG)value);
  166.     }
  167.  
  168.     void SetConstructHook (struct Hook * value)
  169.     {
  170.          SetAttr (MUIA_NList_ConstructHook, (ULONG)value);
  171.     }
  172.  
  173.     void SetCopyColumnToClipHook (struct Hook * value)
  174.     {
  175.          SetAttr (MUIA_NList_CopyColumnToClipHook, (ULONG)value);
  176.     }
  177.  
  178.     void SetCopyEntryToClipHook (struct Hook * value)
  179.     {
  180.          SetAttr (MUIA_NList_CopyEntryToClipHook, (ULONG)value);
  181.     }
  182.  
  183.     void SetDefaultObjectOnClick (BOOL value)
  184.     {
  185.          SetAttr (MUIA_NList_DefaultObjectOnClick, (ULONG)value);
  186.     }
  187.  
  188.     LONG DefClickColumn (void) const
  189.     {
  190.          return (LONG)GetAttr (MUIA_NList_DefClickColumn);
  191.     }
  192.  
  193.     void SetDefClickColumn (LONG value)
  194.     {
  195.          SetAttr (MUIA_NList_DefClickColumn, (ULONG)value);
  196.     }
  197.  
  198.     void SetDestructHook (struct Hook * value)
  199.     {
  200.          SetAttr (MUIA_NList_DestructHook, (ULONG)value);
  201.     }
  202.  
  203.     void SetDisplayHook (struct Hook * value)
  204.     {
  205.          SetAttr (MUIA_NList_DisplayHook, (ULONG)value);
  206.     }
  207.  
  208.     void SetDisplayRecall (BOOL value)
  209.     {
  210.          SetAttr (MUIA_NList_DisplayRecall, (ULONG)value);
  211.     }
  212.  
  213.     BOOL DoubleClick (void) const
  214.     {
  215.          return (BOOL)GetAttr (MUIA_NList_DoubleClick);
  216.     }
  217.  
  218.     BOOL DragSortable (void) const
  219.     {
  220.          return (BOOL)GetAttr (MUIA_NList_DragSortable);
  221.     }
  222.  
  223.     void SetDragSortable (BOOL value)
  224.     {
  225.          SetAttr (MUIA_NList_DragSortable, (ULONG)value);
  226.     }
  227.  
  228.     LONG DragType (void) const
  229.     {
  230.          return (LONG)GetAttr (MUIA_NList_DragType);
  231.     }
  232.  
  233.     void SetDragType (LONG value)
  234.     {
  235.          SetAttr (MUIA_NList_DragType, (ULONG)value);
  236.     }
  237.  
  238.     LONG DropMark (void) const
  239.     {
  240.          return (LONG)GetAttr (MUIA_List_DropMark);
  241.     }
  242.  
  243.     LONG Entries (void) const
  244.     {
  245.          return (LONG)GetAttr (MUIA_NList_Entries);
  246.     }
  247.  
  248.     BOOL EntryValueDependent (void) const
  249.     {
  250.          return (BOOL)GetAttr (MUIA_NList_EntryValueDependent);
  251.     }
  252.  
  253.     void SetEntryValueDependent (BOOL value)
  254.     {
  255.          SetAttr (MUIA_NList_EntryValueDependent, (ULONG)value);
  256.     }
  257.  
  258.     LONG First (void) const
  259.     {
  260.          return (LONG)GetAttr (MUIA_NList_First);
  261.     }
  262.  
  263.     void SetFirst (LONG value)
  264.     {
  265.          SetAttr (MUIA_NList_First, (ULONG)value);
  266.     }
  267.  
  268.     STRPTR Format (void) const
  269.     {
  270.          return (STRPTR)GetAttr (MUIA_NList_Format);
  271.     }
  272.  
  273.     void SetFormat (STRPTR value)
  274.     {
  275.          SetAttr (MUIA_NList_Format, (ULONG)value);
  276.     }
  277.  
  278.     LONG HorizDeltaFactor (void) const
  279.     {
  280.          return (LONG)GetAttr (MUIA_NList_HorizDeltaFactor);
  281.     }
  282.  
  283.     LONG Horiz_Entries (void) const
  284.     {
  285.          return (LONG)GetAttr (MUIA_NList_Horiz_Entries);
  286.     }
  287.  
  288.     LONG Horiz_First (void) const
  289.     {
  290.          return (LONG)GetAttr (MUIA_NList_Horiz_First);
  291.     }
  292.  
  293.     void SetHoriz_First (LONG value)
  294.     {
  295.          SetAttr (MUIA_NList_Horiz_First, (ULONG)value);
  296.     }
  297.  
  298.     LONG Horiz_Visible (void) const
  299.     {
  300.          return (LONG)GetAttr (MUIA_NList_Horiz_Visible);
  301.     }
  302.  
  303.     BOOL Input (void) const
  304.     {
  305.          return (BOOL)GetAttr (MUIA_NList_Input);
  306.     }
  307.  
  308.     void SetInput (BOOL value)
  309.     {
  310.          SetAttr (MUIA_NList_Input, (ULONG)value);
  311.     }
  312.  
  313.     LONG InsertPosition (void) const
  314.     {
  315.          return (LONG)GetAttr (MUIA_NList_InsertPosition);
  316.     }
  317.  
  318.     void SetKeepActive (Object * value)
  319.     {
  320.          SetAttr (MUIA_NList_KeepActive, (ULONG)value);
  321.     }
  322.  
  323.     void SetMakeActive (Object * value)
  324.     {
  325.          SetAttr (MUIA_NList_MakeActive, (ULONG)value);
  326.     }
  327.  
  328.     void SetMinLineHeight (LONG value)
  329.     {
  330.          SetAttr (MUIA_NList_MinLineHeight, (ULONG)value);
  331.     }
  332.  
  333.     BOOL MultiClick (void) const
  334.     {
  335.          return (BOOL)GetAttr (MUIA_NList_MultiClick);
  336.     }
  337.  
  338.     void SetMultiTestHook (struct Hook * value)
  339.     {
  340.          SetAttr (MUIA_NList_MultiTestHook, (ULONG)value);
  341.     }
  342.  
  343.     APTR PrivateData (void) const
  344.     {
  345.          return (APTR)GetAttr (MUIA_NList_PrivateData);
  346.     }
  347.  
  348.     void SetPrivateData (APTR value)
  349.     {
  350.          SetAttr (MUIA_NList_PrivateData, (ULONG)value);
  351.     }
  352.  
  353.     LONG Prop_Entries (void) const
  354.     {
  355.          return (LONG)GetAttr (MUIA_NList_Prop_Entries);
  356.     }
  357.  
  358.     LONG Prop_First (void) const
  359.     {
  360.          return (LONG)GetAttr (MUIA_NList_Prop_First);
  361.     }
  362.  
  363.     void SetProp_First (LONG value)
  364.     {
  365.          SetAttr (MUIA_NList_Prop_First, (ULONG)value);
  366.     }
  367.  
  368.     LONG Prop_Visible (void) const
  369.     {
  370.          return (LONG)GetAttr (MUIA_NList_Prop_Visible);
  371.     }
  372.  
  373.     void SetQuiet (BOOL value)
  374.     {
  375.          SetAttr (MUIA_NList_Quiet, (ULONG)value);
  376.     }
  377.  
  378.     BOOL ShowDropMarks (void) const
  379.     {
  380.          return (BOOL)GetAttr (MUIA_NList_ShowDropMarks);
  381.     }
  382.  
  383.     void SetShowDropMarks (BOOL value)
  384.     {
  385.          SetAttr (MUIA_NList_ShowDropMarks, (ULONG)value);
  386.     }
  387.  
  388.     char * SkipChars (void) const
  389.     {
  390.          return (char *)GetAttr (MUIA_NList_SkipChars);
  391.     }
  392.  
  393.     void SetSkipChars (char * value)
  394.     {
  395.          SetAttr (MUIA_NList_SkipChars, (ULONG)value);
  396.     }
  397.  
  398.     ULONG TabSize (void) const
  399.     {
  400.          return (ULONG)GetAttr (MUIA_NList_TabSize);
  401.     }
  402.  
  403.     void SetTabSize (ULONG value)
  404.     {
  405.          SetAttr (MUIA_NList_TabSize, (ULONG)value);
  406.     }
  407.  
  408.     char * Title (void) const
  409.     {
  410.          return (char *)GetAttr (MUIA_NList_Title);
  411.     }
  412.  
  413.     void SetTitle (char * value)
  414.     {
  415.          SetAttr (MUIA_NList_Title, (ULONG)value);
  416.     }
  417.  
  418.     BOOL TitleSeparator (void) const
  419.     {
  420.          return (BOOL)GetAttr (MUIA_NList_TitleSeparator);
  421.     }
  422.  
  423.     void SetTitleSeparator (BOOL value)
  424.     {
  425.          SetAttr (MUIA_NList_TitleSeparator, (ULONG)value);
  426.     }
  427.  
  428.     void SetTypeSelect (LONG value)
  429.     {
  430.          SetAttr (MUIA_NList_TypeSelect, (ULONG)value);
  431.     }
  432.  
  433.     LONG VertDeltaFactor (void) const
  434.     {
  435.          return (LONG)GetAttr (MUIA_NList_VertDeltaFactor);
  436.     }
  437.  
  438.     LONG Visible (void) const
  439.     {
  440.          return (LONG)GetAttr (MUIA_NList_Visible);
  441.     }
  442.  
  443.     LONG TitleBackground (void) const
  444.     {
  445.          return (LONG)GetAttr (MUIA_NList_TitleBackground);
  446.     }
  447.  
  448.     void SetTitleBackground (LONG value)
  449.     {
  450.          SetAttr (MUIA_NList_TitleBackground, (ULONG)value);
  451.     }
  452.  
  453.     LONG TitlePen (void) const
  454.     {
  455.          return (LONG)GetAttr (MUIA_NList_TitlePen);
  456.     }
  457.  
  458.     void SetTitlePen (LONG value)
  459.     {
  460.          SetAttr (MUIA_NList_TitlePen, (ULONG)value);
  461.     }
  462.  
  463.     ULONG Clear (void)
  464.     {
  465.         return DoMethod (MUIM_NList_Clear);
  466.     }
  467.  
  468.     ULONG CopyToClip (LONG pos, ULONG clipnum)
  469.     {
  470.         return DoMethod (MUIM_NList_CopyToClip, pos, clipnum);
  471.     }
  472.  
  473.     ULONG CreateImage (Object * imgobj, ULONG flags)
  474.     {
  475.         return DoMethod (MUIM_NList_CreateImage, imgobj, flags);
  476.     }
  477.  
  478.     ULONG DeleteImage (APTR listimg)
  479.     {
  480.         return DoMethod (MUIM_NList_DeleteImage, listimg);
  481.     }
  482.  
  483.     ULONG Exchange (LONG pos1, LONG pos2)
  484.     {
  485.         return DoMethod (MUIM_NList_Exchange, pos1, pos2);
  486.     }
  487.  
  488.     ULONG GetEntry (LONG pos, Type * * entry)
  489.     {
  490.         return DoMethod (MUIM_NList_GetEntry, pos, entry);
  491.     }
  492.  
  493.     ULONG GetEntryInfo (struct MUI_NList_GetEntryInfo * res)
  494.     {
  495.         return DoMethod (MUIM_NList_GetEntryInfo, res);
  496.     }
  497.  
  498.     ULONG Insert (Type * * entries, LONG count, LONG pos)
  499.     {
  500.         return DoMethod (MUIM_NList_Insert, entries, count, pos);
  501.     }
  502.  
  503.     ULONG InsertSingle (Type * entry, LONG pos)
  504.     {
  505.         return DoMethod (MUIM_NList_InsertSingle, entry, pos);
  506.     }
  507.  
  508.     ULONG InsertSingleWrap (void)
  509.     {
  510.         return DoMethod (MUIM_NList_InsertSingleWrap);
  511.     }
  512.  
  513.     ULONG InsertWrap (Type * * entries)
  514.     {
  515.         return DoMethod (MUIM_NList_InsertWrap, entries);
  516.     }
  517.  
  518.     ULONG Jump (LONG pos)
  519.     {
  520.         return DoMethod (MUIM_NList_Jump, pos);
  521.     }
  522.  
  523.     ULONG Move (LONG from, LONG to)
  524.     {
  525.         return DoMethod (MUIM_NList_Move, from, to);
  526.     }
  527.  
  528.     ULONG NextSelected (LONG * pos)
  529.     {
  530.         return DoMethod (MUIM_NList_NextSelected, pos);
  531.     }
  532.  
  533.     ULONG Redraw (LONG pos)
  534.     {
  535.         return DoMethod (MUIM_NList_Redraw, pos);
  536.     }
  537.  
  538.     ULONG Remove (LONG pos)
  539.     {
  540.         return DoMethod (MUIM_NList_Remove, pos);
  541.     }
  542.  
  543.     ULONG ReplaceSingle (LONG pos, LONG seltype, LONG * state)
  544.     {
  545.         return DoMethod (MUIM_NList_ReplaceSingle, pos, seltype, state);
  546.     }
  547.  
  548.     ULONG Sort (void)
  549.     {
  550.         return DoMethod (MUIM_NList_Sort);
  551.     }
  552.  
  553.     ULONG TestPos (LONG x, LONG y, struct MUI_NList_TestPos_Result * res)
  554.     {
  555.         return DoMethod (MUIM_NList_TestPos, x, y, res);
  556.     }
  557.  
  558.     ULONG UseImage (Object * obj, ULONG imgnum, ULONG flags)
  559.     {
  560.         return DoMethod (MUIM_NList_UseImage, obj, imgnum, flags);
  561.     }
  562.  
  563. };
  564.  
  565. #endif    /* MUIPP_TEMPLATES */